<?php
class FrmUserEdit{
	private $user;
	private $setter;
	private $dbOperator;
	private $easyForm;
	
	private $ajax;
	
	private $div;
	
	function __construct($user){
//		$this->ajax=new Ajax();
//		
//		$this->ajax->activate();
//		$this->ajax->GETMethodSend();
//		$this->ajax->POSTMethodSend();
//		$this->ajax->tableInfoPOSTMethodSend();
		
		
		$this->user=new User();
		$this->user=$user;
		$this->setter=new Setter("../../Config");
		$this->dbOperator=new DbOperator();
		$this->dbOperator=new DbOperator($this->setter->getDataBaseHost(),$this->setter->getDataBaseUserName(),$this->setter->getDataBaseName(),$this->setter->getDataBasePassword());
		$this->dbOperator->connect();
		$roles=$this->dbOperator->consult("SELECT nombre FROM roles", "yes");
				
		$this->easyForm=new EasyForm("usersFormEdit", "usersFormEdit","get","../../Events/UserServices/EventsFrmUserEdit.php","edición de Usuario:","","","","");
		
		$this->easyForm->addInput(1,"Cedula:","cedulaEdit","cedulaEdit","","yes","","","form","","",array());
		$this->easyForm->setItem("Cedula:",$this->user->getCedula());
		
		$this->easyForm->addInput(1,"Nombre:","nombreEdit","nombreEdit","","","","","form","","",array());
		$this->easyForm->setItem("Nombre:",$this->user->getNombre());
		
		$this->easyForm->addInput(1,"Apellido:","apellidoEdit","apellidoEdit","","","","","form");
		$this->easyForm->setItem("Apellido:",$this->user->getApellido());
		
		$this->easyForm->addInput(1,"Nick:","nickEdit","nickEdit","","yes","","","form");
		$this->easyForm->setItem("Nick:",$this->user->getNick());
		
		$this->easyForm->addInputPassword(1,"Password:","passwordEdit","passwordEdit","","","","","form");
		$this->easyForm->setItem("Password:",$this->user->getPassword());
		
		$this->easyForm->addInputPassword(1,"Confirmar Password:","password2Edit","password2Edit","","","","","form");
		$this->easyForm->setItem("Confirmar Password:",$this->user->getPassword());
		
		//$this->easyForm->addSelectionList(1,"Rol:","rolEdit","rolEdit");
		//$this->easyForm->setItem("Rol:",$roles);
		//$this->easyForm->setOptionsSelectionList("Rol:",$roles,$this->user->getRol());
		
		$this->easyForm->addInput(1, "Telefono:","telefonoEdit","telefonoEdit","","","","","form");
		$this->easyForm->setItem("Telefono:",$this->user->getTelefono());
		
		$this->easyForm->addInput(1, "Dirección:","direccionEdit","direccionEdit","","","","","form");
		$this->easyForm->setItem("Dirección:",$this->user->getDireccion());
		
		$this->easyForm->addInput(1, "Ciudad:","ciudadEdit","ciudadEdit","","","","","form");
		$this->easyForm->setItem("Ciudad:",$this->user->getCiudad());
		
		$this->easyForm->addInput(1, "Pais:","paisEdit","paisEdit","","","","","form");
		$this->easyForm->setItem("Pais:",$this->user->getPais());
		 
		$this->easyForm->addInput(1, "Email:","emailEdit","emailEdit","","","","","form");	
		$this->easyForm->setItem("Email:",$this->user->getEmail());
		
		$this->easyForm->addButton(3,"editar:","EditarU","EditarU","editarU","editar","editar usuario","submit","","button","","Actualizar información","","","0", array());			
		$this->easyForm->addButton(1,"cancelar:","CancelEditarU","CancelEditarU","canceleditarU","cancelar","cancelar editar usuario","button","","button","","Cancelar Actualizar información","","","0", array("onclick"=>"window.close()"));			
		
		$this->div=new Div("editarUserDiv", "editarUserDiv", "forms",array(),"220","550");
	}
	function show(){
		$this->div->start();
			$this->easyForm->show(2,8);
		$this->div->end();
	}
}
?>